const { Controller } = require("egg");

class kujomiva extends Controller {
    async gaolin() {
        const { ctx, app } = this;
        await app.mysql.insert('gaolin', ctx.request.body)

        ctx.returnBody(200, '添加数据成功')
    }
    async check() {
        const { ctx, app } = this;
        const { name } = ctx.request.body;
        console.log(name)
        const result = await app.mysql.get('gaolin', { name });

        ctx.returnBody(200, '获取成功', result)
    }
    async list() {
        const { ctx, app } = this;
        const sql = `select * from gaolin order by id desc`
        const result = await app.mysql.query(sql);
        ctx.returnBody(200, '获取成功', result)
    }
}

module.exports = kujomiva